package cn.tedu.cinema.hall.controller;

import cn.tedu.cinema.base.response.JsonResult;
import cn.tedu.cinema.hall.pojo.dto.HallQuery;
import cn.tedu.cinema.hall.pojo.dto.HallSaveParam;
import cn.tedu.cinema.hall.pojo.vo.HallVO;
import cn.tedu.cinema.hall.service.HallService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/v1/hall")
public class HallController {
    @Autowired
    HallService hallService;

    @PostMapping("save")
    public JsonResult saveHall(HallSaveParam hallSaveParam)
    {
        log.debug("开始处理【保存放映厅】,参数{}", hallSaveParam);
        hallService.saveHall(hallSaveParam);
        return JsonResult.ok();
    }
    @PostMapping("delete/{id}")
    public JsonResult deleteHall(@PathVariable Long id)
    {
        log.debug("开始处理【删除放映厅】,参数{}", id);
        hallService.deleteHall(id);
        return JsonResult.ok();
    }
    @GetMapping("select")
    public JsonResult selectHall(HallQuery hallQuery)
    {
        log.debug("开始处理【查询放映厅】,参数{}",hallQuery);
        List<HallVO> list = hallService.selectHall(hallQuery);
        return JsonResult.ok(list);
    }
}
